#ifndef CONTROLLEDOBJECT_H_
#define CONTROLLEDOBJECT_H_

#include "Object.h"
#include "TextureManager.h"
#include "AnimationManager.h"
#include "SpriteList.h"

#define DUST_FILE "Images/dust.bmp"

class ControlledObject : public Object
{
	//Vector2D sideNormals[4];
	protected:
	float forceDamageDenominator;
	float lastRotation;
	virtual bool GetFreeRotate();
	//virtual void CalculateUpVector();
	float health;
	float maxHealth;
	float movingTimeModifier;
	int textureIndex;
	int poseIndex;
	SpriteList * spriteList;
	TextureManager * textureManager;
	AnimationManager * animationManager;
	bool movingLeft;
	bool movingRight;
	bool isOnHead;
	bool facingRight;
	int rotateCount;
	int isNotOnGroundCount;
	int isOnGroundCount;
	int isOnLeftWallCount;
	int isOnRightWallCount;
	Vector2D * imageVertices;
	virtual float GetAnimationSpeed();
	virtual Vector2D * GetWallPoseCoordinates();
	public:
	virtual Vector2D VelocityAtPoint(Vector2D point);
	ControlledObject( TextureManager * textureManager,
			Vector2D position, 
			Vector2D velocity,
			Vector2D acceleration,
			float rotation,
			float angularVelocity,
			float angularAcceleration,
			float mass,
			bool isPinned);
	virtual ~ControlledObject();
	virtual void AddGravity();
	virtual void DrawCollision();
	virtual void Draw();
	virtual void AddForceObjectSpace(Vector2D ray, Vector2D origin);
	virtual void AddForceObjectSpace(Vector2D ray, Vector2D origin, bool groundForce);
	virtual void Rotate(float theta);
	virtual void ThinkEntryPoint(double elapsedTime);
	virtual bool PreThinkEntryPoint(double elapsedTime);
	virtual void ControlledObjectThinkEntryPoint(double elapsedTime);
	virtual void ControlledObjectDrawEntryPoint();
	virtual void ControlledObjectRotateEntryPoint(float cosTheta, float sinTheta);
	virtual void ControlledObjectAddGravityEntryPoint();
	
	virtual void AddDamage(float damage);
	float GetHealth();
	void SetHealth(float health);
	virtual void MoveRight();
	virtual void MoveLeft();
	virtual void Jump();
};
#endif /*CONTROLLEDOBJECT_H_*/
